using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Raster._MosaicDataset
{
    /// <summary>
    /// <para>Build Mosaic Dataset Item Cache</para>
    /// <para>Inserts the Cached Raster function as the final step in all function chains within a mosaic dataset.</para>
    /// <para>将缓存栅格函数作为镶嵌数据集中所有函数链的最后一步插入。</para>
    /// </summary>    
    [DisplayName("Build Mosaic Dataset Item Cache")]
    public class BuildMosaicDatasetItemCache : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public BuildMosaicDatasetItemCache()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_mosaic_dataset">
        /// <para>Mosaic Dataset</para>
        /// <para>The mosaic dataset where you want to apply the cache function.</para>
        /// <para>要应用缓存函数的镶嵌数据集。</para>
        /// </param>
        public BuildMosaicDatasetItemCache(object _in_mosaic_dataset)
        {
            this._in_mosaic_dataset = _in_mosaic_dataset;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Build Mosaic Dataset Item Cache";

        public override string CallName => "management.BuildMosaicDatasetItemCache";

        public override List<string> AcceptEnvironments => ["extent", "parallelProcessingFactor"];

        public override object[] ParameterInfo => [_in_mosaic_dataset, _where_clause, _define_cache.GetGPValue(), _generate_cache.GetGPValue(), _item_cache_folder, _compression_method.GetGPValue(), _compression_quality, _max_allowed_rows, _max_allowed_columns, _request_size_type.GetGPValue(), _request_size, _out_mosaic_dataset];

        /// <summary>
        /// <para>Mosaic Dataset</para>
        /// <para>The mosaic dataset where you want to apply the cache function.</para>
        /// <para>要应用缓存函数的镶嵌数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Mosaic Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_mosaic_dataset { get; set; }


        /// <summary>
        /// <para>Query Definition</para>
        /// <para>An SQL expression to select specific raster datasets within the mosaic dataset on which you want the item cache built.</para>
        /// <para>一个 SQL 表达式，用于在镶嵌数据集中选择要在其上构建项目缓存的特定栅格数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Query Definition")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _where_clause { get; set; } = null;


        /// <summary>
        /// <para>Define Cache</para>
        /// <para><xdoc>
        ///   <para>Enable editing on the Cache properties.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Add the Cached Raster function to the selected items. If an item already has this function, it will not add another one. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—No raster cache will be defined.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>启用对“缓存”属性的编辑。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 将缓存栅格功能添加到所选项目。如果一个项目已经具有此功能，则不会添加另一个项目。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中—将定义任何栅格缓存。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Define Cache")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _define_cache_value _define_cache { get; set; } = _define_cache_value._true;

        public enum _define_cache_value
        {
            /// <summary>
            /// <para>DEFINE_CACHE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DEFINE_CACHE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_DEFINE_CACHE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_DEFINE_CACHE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Generate Cache</para>
        /// <para><xdoc>
        ///   <para>Choose to generate the cache files based on the properties defined in the Cached Raster function, such as the location and the compression of the cache.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Cache will be generated. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Cache will not be generated.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>选择根据缓存栅格函数中定义的属性（例如缓存的位置和压缩）生成缓存文件。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 将生成缓存。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 不会生成缓存。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Generate Cache")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _generate_cache_value _generate_cache { get; set; } = _generate_cache_value._true;

        public enum _generate_cache_value
        {
            /// <summary>
            /// <para>GENERATE_CACHE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("GENERATE_CACHE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_GENERATE_CACHE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_GENERATE_CACHE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Cache Path</para>
        /// <para><xdoc>
        ///   <para>Choose to overwrite the default location to save your cache. If the mosaic dataset is inside of a file geodatabase, by default, the cache is saved in a folder with the same name as the geodatabase and a .cache extension. If the mosaic dataset is inside of an enterprise geodatabase, by default, the cache will be saved inside of that geodatabase. Once created, the cache will always save to the same location. To save the cache to a different location, you need to first use the Repair Mosaic Dataset tool to specify a new location and run this tool again.</para>
        ///   <para>Once an item cache is created, regenerating an item cache to a different location is not possible by specifying a different cache path and rerunning this tool. It will still generate the item cache in the location where it was generated the first time. However, you can remove this function and insert a new one with the new path or use the Repair Mosaic Dataset tool to modify the cache path and run this tool to generate the item cache in a different location.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>选择覆盖默认位置以保存缓存。如果镶嵌数据集位于文件地理数据库中，则默认情况下，缓存将保存在与地理数据库同名且扩展名为 .cache 的文件夹中。如果镶嵌数据集位于企业级地理数据库中，则默认情况下，缓存将保存在该地理数据库中。创建后，缓存将始终保存到同一位置。若要将缓存保存到其他位置，需要先使用修复镶嵌数据集工具指定新位置，然后再次运行此工具。</para>
        ///   <para>创建项目缓存后，无法通过指定不同的缓存路径并重新运行此工具将项目缓存重新生成为其他位置。它仍将在首次生成项目缓存的位置生成项目缓存。但是，您可以移除此函数并使用新路径插入新函数，或者使用修复镶嵌数据集工具修改缓存路径并运行此工具以在其他位置生成项目缓存。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cache Path")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _item_cache_folder { get; set; } = null;


        /// <summary>
        /// <para>Compression Method</para>
        /// <para><xdoc>
        ///   <para>Choose how you want to compress your data for faster transmission.</para>
        ///   <bulletList>
        ///     <bullet_item>Lossless compression— Retain the values of each pixel when generating cache. Lossless has a compression ratio of approximately 2:1.</bullet_item><para/>
        ///     <bullet_item>Lossy compression— Appropriate when your imagery is only used as a backdrop. Lossy has the highest compression ratio (20:1) but groups similar pixel values to achieve higher compression.</bullet_item><para/>
        ///     <bullet_item>No compression— Do not compress imagery. This will make your imagery slower to transmit but faster to draw because it will not need to be decompressed when viewed.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>选择您希望如何压缩数据以加快传输速度。</para>
        ///   <bulletList>
        ///     <bullet_item>无损压缩 — 在生成缓存时保留每个像素的值。无损的压缩比约为 2：1。</bullet_item><para/>
        ///     <bullet_item>有损压缩 - 适用于仅将影像用作背景的情况。Lossy 具有最高的压缩比 （20：1），但对相似的像素值进行分组以实现更高的压缩率。</bullet_item><para/>
        ///     <bullet_item>无压缩 - 不压缩影像。这将使影像的传输速度变慢，但绘制速度更快，因为在查看时不需要解压缩。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Compression Method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _compression_method_value _compression_method { get; set; } = _compression_method_value._LOSSLESS;

        public enum _compression_method_value
        {
            /// <summary>
            /// <para>No compression</para>
            /// <para>No compression— Do not compress imagery. This will make your imagery slower to transmit but faster to draw because it will not need to be decompressed when viewed.</para>
            /// <para>无压缩 - 不压缩影像。这将使影像的传输速度变慢，但绘制速度更快，因为在查看时不需要解压缩。</para>
            /// </summary>
            [Description("No compression")]
            [GPEnumValue("NONE")]
            _NONE,

            /// <summary>
            /// <para>Lossless compression</para>
            /// <para>Lossless compression— Retain the values of each pixel when generating cache. Lossless has a compression ratio of approximately 2:1.</para>
            /// <para>无损压缩 — 在生成缓存时保留每个像素的值。无损的压缩比约为 2：1。</para>
            /// </summary>
            [Description("Lossless compression")]
            [GPEnumValue("LOSSLESS")]
            _LOSSLESS,

            /// <summary>
            /// <para>Lossy compression</para>
            /// <para>Lossy compression— Appropriate when your imagery is only used as a backdrop. Lossy has the highest compression ratio (20:1) but groups similar pixel values to achieve higher compression.</para>
            /// <para>有损压缩 - 适用于仅将影像用作背景的情况。Lossy 具有最高的压缩比 （20：1），但对相似的像素值进行分组以实现更高的压缩率。</para>
            /// </summary>
            [Description("Lossy compression")]
            [GPEnumValue("LOSSY")]
            _LOSSY,

        }

        /// <summary>
        /// <para>Compression Quality</para>
        /// <para>Set a compression quality when using the lossy method. The compression quality value is between 1 and 100 percent, with 100 compressing the least.</para>
        /// <para>使用有损方法时设置压缩质量。压缩质量值介于 1% 和 100% 之间，其中 100 压缩最少。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Compression Quality")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _compression_quality { get; set; } = 80;


        /// <summary>
        /// <para>Maximum Allowed Rows</para>
        /// <para>Limit the size of the cache dataset by number of rows. If value is more than the number of rows in the dataset, the cache will not generate.</para>
        /// <para>按行数限制缓存数据集的大小。如果值大于数据集中的行数，则不会生成缓存。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Allowed Rows")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_allowed_rows { get; set; } = 200000;


        /// <summary>
        /// <para>Maximum Allowed Columns</para>
        /// <para>Limit the size of the cache dataset by number of columns. If value is more than the number of columns in the dataset, the cache will not generate.</para>
        /// <para>按列数限制缓存数据集的大小。如果 value 大于数据集中的列数，则不会生成缓存。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Allowed Columns")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_allowed_columns { get; set; } = 200000;


        /// <summary>
        /// <para>Request Size Type</para>
        /// <para><xdoc>
        ///   <para>Resample the cache using one of these two methods:</para>
        ///   <bulletList>
        ///     <bullet_item>Pixel size factor— Set a scaling factor relative to the pixel size. To not resample the cache, choose Pixel size factor and set the Request Size parameter to 1.</bullet_item><para/>
        ///     <bullet_item>Pixel size— Specify a pixel size for the cached raster.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>使用以下两种方法之一对缓存进行重新采样：</para>
        ///   <bulletList>
        ///     <bullet_item>像素大小因子 - 设置相对于像素大小的比例因子。若要不对缓存重新采样，请选择 Pixel size factor （像素大小因子） 并将 Request Size （请求大小） 参数设置为 1。</bullet_item><para/>
        ///     <bullet_item>像素大小 - 指定缓存栅格的像素大小。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Request Size Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _request_size_type_value _request_size_type { get; set; } = _request_size_type_value._PIXEL_SIZE_FACTOR;

        public enum _request_size_type_value
        {
            /// <summary>
            /// <para>Pixel size</para>
            /// <para>Pixel size factor— Set a scaling factor relative to the pixel size. To not resample the cache, choose Pixel size factor and set the Request Size parameter to 1.</para>
            /// <para>像素大小因子 - 设置相对于像素大小的比例因子。若要不对缓存重新采样，请选择 Pixel size factor （像素大小因子） 并将 Request Size （请求大小） 参数设置为 1。</para>
            /// </summary>
            [Description("Pixel size")]
            [GPEnumValue("PIXEL_SIZE")]
            _PIXEL_SIZE,

            /// <summary>
            /// <para>Pixel size factor</para>
            /// <para>Pixel size factor— Set a scaling factor relative to the pixel size. To not resample the cache, choose Pixel size factor and set the Request Size parameter to 1.</para>
            /// <para>像素大小因子 - 设置相对于像素大小的比例因子。若要不对缓存重新采样，请选择 Pixel size factor （像素大小因子） 并将 Request Size （请求大小） 参数设置为 1。</para>
            /// </summary>
            [Description("Pixel size factor")]
            [GPEnumValue("PIXEL_SIZE_FACTOR")]
            _PIXEL_SIZE_FACTOR,

        }

        /// <summary>
        /// <para>Request Size</para>
        /// <para>Set a value to apply to the Request Size Type.</para>
        /// <para>设置要应用于“请求大小类型”的值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Request Size")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _request_size { get; set; } = 1;


        /// <summary>
        /// <para>Updated Mosaic Dataset</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Mosaic Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_mosaic_dataset { get; set; }


        public BuildMosaicDatasetItemCache SetEnv(object extent = null, object parallelProcessingFactor = null)
        {
            base.SetEnv(extent: extent, parallelProcessingFactor: parallelProcessingFactor);
            return this;
        }

    }

}